<template>
    <div class="jg-logger-table-list">
        <el-table
                ref="JGLoggerTable"
                :data="tableData"
                :height="tableHeight"
                border
                style="width: 100%"
                @selection-change="handleSelectionChange"
                :default-sort="defaultSort">
            <el-table-column
                    type="selection"
                    show-overflow-tooltip
                    width="50">
            </el-table-column>
            <el-table-column
                    prop="number"
                    label="编号"
                    width="80"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="JGName"
                    label="机构名称"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="JGType"
                    label="机构类型"
                    width="105"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="loggerOwner"
                    label="日志所属人"
                    width="125"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="head"
                    label="负责人"
                    width="95"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="contact"
                    label="联系人"
                    width="95"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="loggerDate"
                    label="日志日期"
                    width="105"
                    sortable>
            </el-table-column>
            <el-table-column
                    prop="loggerLevel"
                    label="日志等级"
                    width="105"
                    sortable>
            </el-table-column>
            <el-table-column label="操作" width="210">
                <template slot-scope="scope">
                    <el-button
                            size="mini"
                            @click="handleEdit(scope.$index, scope.row)">编辑
                    </el-button>
                    <el-button
                            size="mini"
                            type="danger"
                            @click="handleDelete(scope.$index, scope.row)">删除
                    </el-button>
                    <el-button size="mini" type="primary" @click="handleLook(scope.$index, scope.row)">查看</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
    export default {
        name: "JGLoggerTableList",
        props: {
            tableHeight: {
                required: false,
                type: String,
                default: () => {
                    return "550";
                }
            },
            defaultSort: {
                required: false,
                type: Object,
                default: () => {
                    return {prop: 'number', order: 'descending'};
                }
            }
        },
        data() {
            return {
                multipleSelection: [],
                tableData: [{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '重要日志'
                },{
                    number: '10021',
                    JGName: '九江市科技情报所',
                    JGType: '党政',
                    loggerOwner: '张丽',
                    head: '夏晓芳',
                    contact: '李小凡',
                    loggerDate: '2015-11-04',
                    loggerLevel: '一般日志'
                }]
            }
        },
        methods: {
            /**
             * 编辑
             * @param index
             * @param row
             */
            handleEdit(index, row) {
                console.log(index, row);
            },
            /**
             * 删除
             * @param index
             * @param row
             */
            handleDelete(index, row) {
                console.log(index, row);
            },
            /**
             * 查看
             * @param index
             * @param row
             */
            handleLook(index, row) {
                console.log(index, row);
            },
            /**
             * 选中行处理
             * @param val
             */
            handleSelectionChange(val) {
                this.multipleSelection = val;
            }
        }
    }
</script>

<style lang="scss">
    .jg-logger-table-list {

    }
</style>